package com.system.ad.advice;


import com.system.ad.exception.AdException;
import com.system.ad.vo.Result;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

import javax.servlet.http.HttpServletRequest;

@RestControllerAdvice
public class GlobalExceptionAdvice {

    @ExceptionHandler(value = AdException.class)
    public Result handlerAdException(HttpServletRequest request, AdException exception) {
        return Result.error(-1, exception.getMessage());
    }
}
